{% extends "base_docs.html" %}
{% load i18n fundraising_extras docs %}

{% block title %}{{ doc.title|striptags|safe }} | {% trans "Django documentation" %}{% endblock %}

{% block doc_url %}{% url 'document-index' lang=lang version=version host 'docs' %}{% endblock %}

{% block head_extra %}
  {% if docurl %}
    {% if "internals" in docurl %} {# The canonical version of "internals" is the dev docs. #}
      {% url 'document-detail' lang=lang version='dev' url=docurl host 'docs' as canonical_url %}
    {% else %}
      {% url 'document-detail' lang=lang version=canonical_version url=docurl host 'docs' as canonical_url %}
    {% endif %}
  {% else %}
    {% url 'document-index' lang=lang version=canonical_version host 'docs' as canonical_url %}
  {% endif %}
  <link rel="canonical" href="{{ canonical_url }}">
  {% if canonical %}
    {% for available_lang in available_languages %}
        {% if docurl %}
          {% url 'document-detail' lang=available_lang version=version url=docurl host 'docs' as alternate_url %}
        {% else %}
          {% url 'document-index' lang=available_lang version=version host 'docs' as alternate_url %}
        {% endif %}
        {% if available_lang == "en" %}
        <link rel="alternate"
           hreflang="x-default"
           href="{{ alternate_url }}">
        {% endif %}
        <link rel="alternate"
           hreflang="{{ available_lang }}"
           href="{{ alternate_url }}">
    {% endfor %}
  {% endif %}

  <link rel="search"
        type="application/opensearchdescription+xml"
        href="{% url 'document-search-description' lang=lang version=version host 'docs' %}"
        title="{% trans "Django documentation" %}">
{% endblock head_extra %}

{% block body_extra %}
{% if release.is_dev %}
<div id="dev-warning" class="doc-floating-warning">
  {% trans "This document is for Django's development version, which can be significantly different from previous releases. For older releases, use the version selector floating in the bottom right corner of this page." %}
</div>
{% elif not release.is_supported %}
<div id="outdated-warning" class="doc-floating-warning">
  {% trans "This document is for an insecure version of Django that is no longer supported. Please upgrade to a newer release!" %}
</div>
{% endif %}
{% endblock body_extra %}

{% block content %}
<div id="version-switcher">
  <ul id="doc-languages" class="language-switcher">
  {% for available_lang in available_languages %}
  {% if lang != available_lang %}
  <li class="other">
    {% if docurl %}
      {% url 'document-detail' lang=available_lang version=version url=docurl host 'docs' as other_url %}
    {% else %}
      {% url 'document-index' lang=available_lang version=version host 'docs' as other_url %}
    {% endif %}
    <a href="{{ other_url }}{% if searchparams %}search/?{{ searchparams }}{% endif %}">{{ available_lang }}</a>
  </li>
  {% endif %}
  {% endfor %}
    <li class="current"
        title="{% blocktrans %}Click on the links on the left to switch to another language.{% endblocktrans %}">
      <span>{% trans "Language:" %} <strong>{{ lang }}</strong></span>
    </li>
  </ul>

  {% get_all_doc_versions docurl as other_versions %}
  <ul id="doc-versions" class="version-switcher">
    {% for other_version in other_versions %}
    {% if version != other_version %}
    <li class="other">
      {% if docurl %}
        {% url 'document-detail' lang=lang version=other_version url=docurl host 'docs' as other_url %}
      {% else %}
        {% url 'document-index' lang=lang version=other_version host 'docs' as other_url %}
      {% endif %}
      <a href="{{ other_url }}{% if searchparams %}search/?{{ searchparams }}{% endif %}">{{ other_version }}</a>
    </li>
    {% endif %}
    {% endfor %}
    <li class="current{% if release.is_dev %} dev{% endif %}"
        title="{% if release.is_dev %}{% blocktrans trimmed %}
      This document is for Django's development version, which can be significantly different from previous releases.
    {% endblocktrans %}{% else %}{% blocktrans trimmed %}
      This document describes Django {{ version }}.
    {% endblocktrans %}{% endif %} {% blocktrans trimmed %}
      Click on the links on the left to see other versions.
    {% endblocktrans %}">
       <span>{% trans "Documentation version:" %}
         <strong>{% if release.is_dev %}development{% else %}{{ version }}{% endif %}</strong>
       </span>
    </li>
  </ul>
</div>

{% block body %}
<div id="docs-content">
{{ doc.body|safe }}
</div>
{% endblock body %}

{% if doc.prev or doc.next %}
<div class="browse-horizontal">
  {% if doc.prev %}
  <div class="left"><a href="{{ doc.prev.link }}"><i class="icon icon-chevron-left"></i> {{ doc.prev.title|safe }}</a></div>
  {% endif %}
  {% if doc.next %}
  <div class="right"><a href="{{ doc.next.link }}">{{ doc.next.title|safe }} <i class="icon icon-chevron-right"></i></a></div>
  {% endif %}
</div>
{% endif %}

{% endblock content %}


{% block content-related %}
<h1 class="visuallyhidden">{% trans "Additional Information" %}</h1>
<div role="complementary">
  {% block search %}
  {% search_form %}
  {% endblock search %}

  {% donation_snippet %}

  {% block toc-wrapper %}
    <h2>{% trans "Contents" %}</h2>
    {% block toc %}
    {{ doc.toc|safe }}
    {% endblock toc %}
  {% endblock toc-wrapper %}

  {% block browse-wrapper %}
  <h2>{% trans "Browse" %}</h2>
  <ul>
    {% block browse %}
    {% if doc.prev %}
    <li>{% trans "Prev:" %} <a href="{{ doc.prev.link }}">{{ doc.prev.title|safe }}</a></li>
    {% endif %}
    {% if doc.next %}
    <li>{% trans "Next:" %} <a href="{{ doc.next.link }}">{{ doc.next.title|safe }}</a></li>
    {% endif %}
    <li><a href="{% url 'document-detail' lang=lang version=version url="contents" host 'docs' %}">{% trans "Table of contents" %}</a></li>
    {% for doc, title, accesskey, shorttitle in env.rellinks %}
    <li><a href="{% url 'document-detail' lang=lang version=version url=doc host 'docs' %}">{{ title }}</a></li>
    {% endfor %}
    {% endblock browse %}
  </ul>
  {% endblock browse-wrapper %}

  {% block breadcrumbs-wrapper %}
  <h2>{% trans "You are here:" %}</h2>
  <ul>
    <li>
      <a href="{% url 'document-index' lang=lang version=version host 'docs' %}">{% blocktrans %}Django {{ version }} documentation{% endblocktrans %}</a>
      {% for p in doc.parents %}
      <ul><li><a href="{{ p.link }}">{{ p.title|safe }}</a>
      {% endfor %}
      <ul><li>{% block current-page-title %}{{ doc.title|safe }}{% endblock current-page-title %}</li></ul>
      {% for p in doc.parents %}</li></ul>{% endfor %}
    </li>
  </ul>
  {% endblock breadcrumbs-wrapper %}

  {% block help-wrapper %}
  <h2 id="getting-help-sidebar">{% trans "Getting help" %}</h2>
  <dl class="list-links">
    <dt><a href="{% url 'document-detail' lang=lang version=version url="faq" host 'docs' %}">FAQ</a></dt>
    <dd>{% blocktrans %}Try the FAQ — it's got answers to many common questions.{% endblocktrans %}</dd>

    <dt><a href="/en/stable/genindex/">{% trans "Index" %}</a>, <a href="/en/stable/py-modindex/">{% trans "Module Index" %}</a>, or <a href="/en/stable/contents/">{% trans "Table of Contents" %}</a></dt>
    <dd>{% blocktrans %}Handy when looking for specific information.{% endblocktrans %}</dd>

    <dt><a href="https://groups.google.com/group/django-users/">django-users mailing list</a></dt>
    <dd>{% blocktrans %}Search for information in the archives of the django-users mailing list, or post a question.{% endblocktrans %}</dd>

    <dt><a href="irc://irc.freenode.net/django">#django IRC channel</a></dt>
    <dd>{% blocktrans %}Ask a question in the #django IRC channel, or search the IRC logs to see if it’s been asked before.{% endblocktrans %}</dd>

    <dt><a href="https://code.djangoproject.com/">Ticket tracker</a></dt>
    <dd>{% blocktrans %}Report bugs with Django or Django documentation in our ticket tracker.{% endblocktrans %}</dd>
  </dl>
  {% endblock help-wrapper %}

  {% block links-wrapper %}
  <h2>{% trans "Download:" %}</h2>
  <p>
    {% if version == "dev" %}{% trans "Offline (development version):" %}
    {% else %}{% blocktrans %}Offline (Django {{ version }}):{% endblocktrans %}{% endif %}
    <a href="{{ MEDIA_URL }}docs/django-docs-{{ version }}-{{ lang }}.zip">HTML</a> |
    <a href="https://media.readthedocs.org/pdf/django/{{ rtd_version }}/django.pdf">PDF</a> |
    <a href="https://media.readthedocs.org/epub/django/{{ rtd_version }}/django.epub">ePub</a>
    <br>
    <span class="quiet">
      {% blocktrans %}Provided by <a href="https://readthedocs.org/">Read the Docs</a>.{% endblocktrans %}
    </span>
  </p>
  {% endblock links-wrapper %}
</div>
{% endblock content-related %}
